Skip to content

support harmony remote by mjpeg #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 13, 2025

Conversation

lixf6
Copy link
Collaborator

@lixf6 lixf6 commented Jun 8, 2025

No description provided.

@codeskyblue codeskyblue requested a review from Copilot June 12, 2025 02:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for HarmonyOS remote screen streaming via MJPEG and integrates it into the application. Key changes include updating scrcpy server path formatting, introducing a new HTML page for video display and associated WebSocket handling, implementing the HarmonyMjpegServer class for HarmonyOS, and updating dependency management and documentation.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uiautodev/remote/scrcpy.py Adjusted code formatting for scrcpy server JAR path initialization
uiautodev/remote/html/harmony-video.html Added a new HTML page for MJPEG video stream with WebSocket logic
uiautodev/remote/harmony_scrcpy.py Introduced HarmonyMjpegServer for handling HarmonyOS screen streaming
uiautodev/app.py Added a new WebSocket endpoint and helper function for HarmonyOS
pyproject.toml Updated dependencies and extras for HarmonyOS support
README.md Updated installation instructions for the HarmonyOS extras package
Comments suppressed due to low confidence (1)

uiautodev/remote/html/harmony-video.html:124

  • The coordinate logging indicates a value of 0 for startX (and similarly for other coordinates), which may signal an issue with the coordinate calculation logic or event processing. Please verify that the calculateCoordinates() function correctly translates canvas coordinates, or remove these debug logs if they are no longer required.
console.log(startX); // 输出 0

Comment on lines 80 to 99
// isMouseDown = true;
downCoordinates = calculateCoordinates(event)


// 按下即触发点击事件
// sendMouseEvent('normal', downCoordinates);
// endX = startX;
// endY = startY;

// Long press detection
// longPressTimer = setTimeout(function() {
// if (isMouseDown) {
// sendMouseEvent('long', { clientX: startX, clientY: startY });
// }
// }, 500); // Long press time threshold in milliseconds
});

// canvas.addEventListener('mousemove', function(event) {
// console.log('move', event.clientX, event.clientY)
// if (isMouseDown) {
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider removing or cleaning up commented-out code blocks in the mouse event handlers to enhance code clarity and maintainability, particularly if they are no longer needed for debugging or future functionality.

Suggested change
// isMouseDown = true;
downCoordinates = calculateCoordinates(event)
// 按下即触发点击事件
// sendMouseEvent('normal', downCoordinates);
// endX = startX;
// endY = startY;
// Long press detection
// longPressTimer = setTimeout(function() {
// if (isMouseDown) {
// sendMouseEvent('long', { clientX: startX, clientY: startY });
// }
// }, 500); // Long press time threshold in milliseconds
});
// canvas.addEventListener('mousemove', function(event) {
// console.log('move', event.clientX, event.clientY)
// if (isMouseDown) {
downCoordinates = calculateCoordinates(event);
});
// Future implementation for mousemove event can be added here if needed.

Copilot uses AI. Check for mistakes.

self.is_running = False

def connect(self):
self.channel = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Copy link
Preview

Copilot AI Jun 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider setting a timeout on the socket (e.g., using settimeout) to avoid potential blocking during long network reads in production environments.

Suggested change
self.channel = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.channel = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.channel.settimeout(10) # Set a timeout of 10 seconds for socket operations

Copilot uses AI. Check for mistakes.

@codeskyblue codeskyblue merged commit 57afe55 into master Jun 13, 2025
6 checks passed
@codeskyblue codeskyblue deleted the feature-lixf6-support-harmony-mjpeg-remote branch June 13, 2025 02:32
codeskyblue added a commit that referenced this pull request Jun 18, 2025
* support harmony remote by mjpeg

* support harmony remote by mjpeg   optimize server name

* adjust pip install of harmony dependencies

* adjust pip install of harmony dependencies fixed extras

* adjust pip install of harmony dependencies fixed import

* adjust pip install of harmony dependencies fixed import test setuptools

* adjust pip install of harmony dependencies fixed import test setuptools lazy

* do little update

* update readme, move html to examples

---------

Co-authored-by: codeskyblue <codeskyblue@gmail.com>
codeskyblue added a commit that referenced this pull request Jun 18, 2025
* support harmony remote by mjpeg

* support harmony remote by mjpeg   optimize server name

* adjust pip install of harmony dependencies

* adjust pip install of harmony dependencies fixed extras

* adjust pip install of harmony dependencies fixed import

* adjust pip install of harmony dependencies fixed import test setuptools

* adjust pip install of harmony dependencies fixed import test setuptools lazy

* do little update

* update readme, move html to examples

---------

Co-authored-by: codeskyblue <codeskyblue@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants